"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Redux = require("redux");
const redux_thunk_1 = require("redux-thunk");
const react_navigation_redux_helpers_1 = require("react-navigation-redux-helpers");
const reducer_1 = require("./reducer");
const react_native_1 = require("react-native");
const fetchpromise_1 = require("./middleware/fetchpromise");
const utils = require("../utils");
const urls_1 = require("../constants/urls");
fetchpromise_1.setGenerateUUID(() => utils.generateUUID('fetchPromise'));
// setPayloadKeysFun('uid',(store:StoreState)=>store.model.user.uid);
fetchpromise_1.setPayloadKeyFun('url', () => urls_1.default.APIURL);
fetchpromise_1.setPostKeyFun('appid', () => 109);
// setPostKeyFun('access_token',);
const mList = [
    redux_thunk_1.default,
    fetchpromise_1.createFetchPromiseMiddleware(),
    react_navigation_redux_helpers_1.createReactNavigationReduxMiddleware('root', (state) => state.ui.nav),
];
let middleware = Redux.applyMiddleware(...mList);
if (__DEV__) {
    const devTool = require('remote-redux-devtools');
    const composeEnhancers = devTool.composeWithDevTools({
        name: react_native_1.Platform.OS,
        hostname: 'localhost',
        port: 5678,
    });
    middleware = composeEnhancers(middleware);
}
exports.store = Redux.createStore(reducer_1.reducer, middleware);
